import {
  useNavigate,
  createBrowserHistory,
  createHashHistory,
  createSearchParams,
  Helmet,
  terminal,
} from "umi";

const obj = {
  name: "zhangsan",
  age: "20",
};

const Index = () => {
  const history = createHashHistory();
  const navigate = useNavigate();

  const fn = () => {
    terminal.log(history);
    history.push("/home");
  };

  const goTs = () => {
    const search = createSearchParams(obj).toString();

    navigate("/ts?" + search);
  };

  return (
    <>
      <Helmet>
        <title>umi的api页面</title>
      </Helmet>
      <h2>api</h2>
      <button onClick={fn}>btn</button>
      <button onClick={goTs}>跳转到ts页面</button>
    </>
  );
};

export default Index;
